<template>
  <div><button @click="fn">点击</button></div>
  <div class="box"
       v-if="fag"></div>
</template>
<script setup>
import { ref, onMounted, onUpdated } from 'vue'
onMounted(() => {
  console.log("---------------onMounted");
  let box = document.getElementsByClassName('box');
  console.log(box);
})
onUpdated(() => {
  console.log("---------------onUpdated");
})
console.log("---------------123");
let fag = ref(true);
const fn = () => {
  if (fag.value) {
    fag.value = false;
  } else {
    fag.value = true;
  }
  console.log("---------------fag", fag.value);
}
</script>

<style scoped>
.box {
  height: 100px;
  width: 100px;
  background: red;
}
</style>
